/**
 * ____________________ *
 *  ____ ____ ____ _  _ *
 *  |___ [__] |--< |\/| *
 * ____________________ *
 *
 * THE CORM PROJECT
 *
 * This file may only be used in accordance with the
 * terms of the Academic Free License ("AFL") v. 3.0,
 * as published by the Open Software Initiative.  A
 * copy of this license is provided in this source
 * release, and may be viewed online at:
 *
 * (http://www.opensource.org/licenses/afl-3.0.php)
 */
package org.eremite.corm.product;

import org.jscience.physics.amount.Amount;

public class MeasuredProductInstance extends ProductInstance {

    private Amount<ProductType> amount;

    public MeasuredProductInstance() {}

    /**
     * A convenience constructor for MeasuredProductInstance.
     * In addition to establishing the [@link ProductType],
     * this constructor draws the name and description from
     * the ProductType as well.
     * @param amount representing the quantity
     * @param type ProductType of the ProductInstance
     */
    public MeasuredProductInstance(long amount, ProductType type) {
        setProductType(type);
        setName(type.getName());
        setDescription(type.getDescription());
        setAmount(Amount.valueOf(amount, this));
    }

    public Amount<ProductType> getAmount() {
        return amount;
    }

    public void setAmount(Amount<ProductType> amount) {
        this.amount = amount;
    }

}
